import 'package:flutter_taotaoshipin/generated/json/base/json_convert_content.dart';
import 'package:flutter_taotaoshipin/model/drama_main_list_entity.dart';

DramaMainListEntity $DramaMainListEntityFromJson(Map<String, dynamic> json) {
  final DramaMainListEntity dramaMainListEntity = DramaMainListEntity();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    dramaMainListEntity.id = id;
  }
  final int? type = jsonConvert.convert<int>(json['type']);
  if (type != null) {
    dramaMainListEntity.type = type;
  }
  final String? typeName = jsonConvert.convert<String>(json['type_name']);
  if (typeName != null) {
    dramaMainListEntity.typeName = typeName;
  }
  final String? title = jsonConvert.convert<String>(json['title']);
  if (title != null) {
    dramaMainListEntity.title = title;
  }
  final String? cover = jsonConvert.convert<String>(json['cover']);
  if (cover != null) {
    dramaMainListEntity.cover = cover;
  }
  final String? thumbCover = jsonConvert.convert<String>(json['thumb_cover']);
  if (thumbCover != null) {
    dramaMainListEntity.thumbCover = thumbCover;
  }
  final String? desc = jsonConvert.convert<String>(json['desc']);
  if (desc != null) {
    dramaMainListEntity.desc = desc;
  }
  final int? allEp = jsonConvert.convert<int>(json['all_ep']);
  if (allEp != null) {
    dramaMainListEntity.allEp = allEp;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    dramaMainListEntity.sort = sort;
  }
  return dramaMainListEntity;
}

Map<String, dynamic> $DramaMainListEntityToJson(DramaMainListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['type'] = entity.type;
  data['type_name'] = entity.typeName;
  data['title'] = entity.title;
  data['cover'] = entity.cover;
  data['thumb_cover'] = entity.thumbCover;
  data['desc'] = entity.desc;
  data['all_ep'] = entity.allEp;
  data['sort'] = entity.sort;
  return data;
}

extension DramaMainListEntityExtension on DramaMainListEntity {
  DramaMainListEntity copyWith({
    int? id,
    int? type,
    String? typeName,
    String? title,
    String? cover,
    String? thumbCover,
    String? desc,
    int? allEp,
    int? sort,
  }) {
    return DramaMainListEntity()
      ..id = id ?? this.id
      ..type = type ?? this.type
      ..typeName = typeName ?? this.typeName
      ..title = title ?? this.title
      ..cover = cover ?? this.cover
      ..thumbCover = thumbCover ?? this.thumbCover
      ..desc = desc ?? this.desc
      ..allEp = allEp ?? this.allEp
      ..sort = sort ?? this.sort;
  }
}